package code.rocky.chapter02;

import java.util.Scanner;

public class Suggest28 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int i = scanner.nextInt();
            System.out.println("\n====" + i + " 的相等判断");
            // 2 个通过  new 产生的 Integer 对象
            Integer one = new Integer(i);
            Integer two = new Integer(i);

            System.out.println("new 产生的对象: " + (one == two));
            one = i;
            two = i;
            System.out.println("基本类型转换的对象: " + (one == two));

            // 通过静态方法生成一个实例
            one = Integer.valueOf(i);
            two = Integer.valueOf(i);
            System.out.println("valueOf产生的对象: " + (one == two));
        }
    }
}
